package ua.org.nuos.sdms.clientgui.client.util;

import ua.org.nuos.sdms.middle.entity.Group;

/**
 * Created by IntelliJ IDEA.
 * User: dio
 * Date: 27.03.12
 * Time: 20:08
 * To change this template use File | Settings | File Templates.
 */
public class DescriptionBuilder {

    public static String buildGroupDescription(Group group) {
        final String basic = "Выбрать группу <b>\"%s\"</b>";
        final String about = "<br /><i>Описание:<i><br />%s";
        String description = String.format(basic, group.getName());
        if (group.getAbout() != null && !group.getAbout().isEmpty()) {
            String aboutBR = group.getAbout().replaceAll("\n", "<br />");
            description += String.format(about, aboutBR);
        }
        return description;
    }
}
